﻿Public Class TB_PRUEBA_DISEÑO_PREGUNTA


    'Public Shared Sub ACTUALIZA_PRUEBA_DISENNO_PREGUNTA _
    '    ( _
    '     ByRef Rp As DotNetResponse.SQLPersistence, _
    '     ByRef Exec As DotNetDal.SQLPersistence, _
    '     ByVal ID_SECCION As Long, _
    '     ByVal NOMBRE_SECCION As String, _
    '     ByVal PUNTOS As Integer, _
    '     ByVal usuario As String, _
    '     ByVal Observacion As String _
    '     )




    '    Dim LocalCommit As Boolean = False
    '    Dim Rpexec As New DotNetResponse.SQLPersistence
    '    Rpexec.StoredProcedure = "SP_ACTUALIZA_PRUEBA_DISENNO_SECCION"
    '    If Exec Is Nothing Then
    '        Exec = New DotNetDal.SQLPersistence(True, "cnn", DotNetDal.SQLPersistence.Provider.SQLCLIENT)
    '        LocalCommit = True
    '    End If

    '    Rpexec.AddParametro(ID_SECCION)
    '    Rpexec.AddParametro(NOMBRE_SECCION)
    '    Rpexec.AddParametro(PUNTOS)
    '    Rpexec.AddParametro(Observacion)

    '    Exec.ExecuteNonQuery(Rpexec)
    '    If LocalCommit Then
    '        Exec.Commit()
    '        Exec.Dispose()
    '    End If

    '    Rp.Errores = Rpexec.Errores
    '    Rp.MensajeError = Rpexec.MensajeError

    'End Sub

    Public Shared Sub CREAR_PRUEBA_DISENNO_PREGUNTA _
        ( _
          ByRef Rp As DotNetResponse.SQLPersistence _
        , ByRef Exec As DotNetDal.SQLPersistence _
        , ByVal P_PREGUNTA As String _
        , ByVal K_SECCION As String _
        , ByVal S_DESCRIPCION_PREGUNTA As String _
        , ByVal M_IMAGEN_PREGUNTA As Byte() _
        , ByVal S_MUESTRA_IMAGEN As String _
        , ByVal I_PUNTOS_PREGUNTA As String _
        , ByVal S_VIGENTE As String _
        , ByVal I_NRO_PREGUNTA As String _
        , ByVal S_AUD_USUARIO As String _
        , ByVal K_TIPO_PREGUNTA As String _
        , ByVal I_CHK_IMAGEN As String _
        , ByVal S_IMAGEN_PREGUNTA As String _
        , ByVal URL_IMAGEN As String)

        '          SP_CREAR_PREGUNTA_DISENNO()
        '         @ numeric(18,0)   
        '        ,@  numeric(18,0)   
        '        ,@ varchar(4000)   
        '        ,@  image   
        '        ,@  varchar(1)   
        '        ,@  int   
        '        ,@  varchar(1)   
        '        ,@  int   
        '        ,@  varchar(50)   
        '        ,@  varchar(50)   
        '        ,@  varchar(16)   
        '        ,@  varchar(16)   
        '        ,@  numeric(18,0)   
        '        ,@  int   
        '        ,@  varchar(4000)  
        '        ,@


        Dim LocalCommit As Boolean = False
        Dim Rpexec As New DotNetResponse.SQLPersistence
        Rpexec.StoredProcedure = "SP_CREAR_PREGUNTA_DISENNO"
        If Exec Is Nothing Then
            Exec = New DotNetDal.SQLPersistence(True, "cnn", DotNetDal.SQLPersistence.Provider.SQLCLIENT)
            LocalCommit = True
        End If

        Rpexec.AddParametro(P_PREGUNTA)
        Rpexec.AddParametro(K_SECCION)
        Rpexec.AddParametro(S_DESCRIPCION_PREGUNTA)
        Rpexec.AddParametro(M_IMAGEN_PREGUNTA)
        Rpexec.AddParametro(S_MUESTRA_IMAGEN)
        Rpexec.AddParametro(I_PUNTOS_PREGUNTA)
        Rpexec.AddParametro(S_VIGENTE)
        Rpexec.AddParametro(I_NRO_PREGUNTA)
        Rpexec.AddParametro(S_AUD_USUARIO)
        Rpexec.AddParametro(K_TIPO_PREGUNTA)
        Rpexec.AddParametro(I_CHK_IMAGEN)
        Rpexec.AddParametro(S_IMAGEN_PREGUNTA)
        Rpexec.AddParametro(URL_IMAGEN)

        Exec.ExecuteScalar(Rpexec)
        If LocalCommit Then
            Exec.Commit()
            Exec.Dispose()
        End If

        Rp.GetScalar = Rpexec.GetScalar
        Rp.Errores = Rpexec.Errores
        Rp.MensajeError = Rpexec.MensajeError
    End Sub
    Public Shared Sub ELIMINA_PRUEBA_DISENNO_PREGUNTA(ByRef Rp As DotNetResponse.SQLPersistence, ByRef Exec As DotNetDal.SQLPersistence, ByVal ID_PREGUNTA As Long, ByVal usuario As String)
        Dim LocalCommit As Boolean = False
        Dim Rpexec As New DotNetResponse.SQLPersistence
        Rpexec.StoredProcedure = "SP_ELIMINA_PRUEBA_DISENNO_PREGUNTA"
        If Exec Is Nothing Then
            Exec = New DotNetDal.SQLPersistence(True, "cnn", DotNetDal.SQLPersistence.Provider.SQLCLIENT)
            LocalCommit = True
        End If
        Rpexec.AddParametro(ID_PREGUNTA)

        Exec.ExecuteNonQuery(Rpexec)
        If LocalCommit Then
            Exec.Commit()
            Exec.Dispose()
        End If

        Rp.GetScalar = Rpexec.GetScalar
        Rp.Errores = Rpexec.Errores
        Rp.MensajeError = Rpexec.MensajeError
    End Sub
    Public Sub SELECCIONA_PRUEBA_DISENNO_SECCION_PK(ByRef Rp As DotNetResponse.SQLPersistence, _
                                                           ByRef Exec As DotNetDal.SQLPersistence, _
                                                           ByVal ID_SECCION As Long, _
                                                           ByVal usuario As String)
        Dim LocalCommit As Boolean = False
        Dim Rpexec As New DotNetResponse.SQLPersistence
        'Rpexec.StoredProcedure = "SP_SELECCIONA_PRUEBA_DISENNO_SECCION_PK"
        If Exec Is Nothing Then
            Exec = New DotNetDal.SQLPersistence(False, "cnn", DotNetDal.SQLPersistence.Provider.SQLCLIENT)
            LocalCommit = True
        End If
        Rpexec.AddParametro(ID_SECCION)
        Exec.ExecuteScalar(Rpexec)
        If LocalCommit Then
            Exec.Commit()
            Exec.Dispose()
        End If

        Rp.DtTable = Rpexec.DtTable
        Rp.Errores = Rpexec.Errores
        Rp.MensajeError = Rpexec.MensajeError
    End Sub

    Public Sub SELECCIONA_PRUEBA_DISENNO_SECCION_FK(ByRef Rp As DotNetResponse.SQLPersistence, ByRef Exec As DotNetDal.SQLPersistence, ByVal FK_PRUEBA As Long, ByVal usuario As String)
        Dim LocalCommit As Boolean = False
        Dim Rpexec As New DotNetResponse.SQLPersistence
        'Rpexec.StoredProcedure = "SP_SELECCIONA_PRUEBA_DISENNO_SECCION_FK"

        If Exec Is Nothing Then
            Exec = New DotNetDal.SQLPersistence(False, "cnn", DotNetDal.SQLPersistence.Provider.SQLCLIENT)
            LocalCommit = True
        End If

        Dim csql As String = "select P_SECCION,S_NOMBRE_SECCION , I_PUNTOS ,I_NRO_SECCION, s_observacion   from TB_PRUEBA_DISENO_SECCION where k_PRUEBA =" & FK_PRUEBA

        'Rpexec.AddParametro(FK_PRUEBA)

        Exec.ExecuteScalar(Rpexec, csql)
        If LocalCommit Then
            Exec.Commit()
            Exec.Dispose()
        End If

        Rp.DtTable = Rpexec.DtTable
        Rp.Errores = Rpexec.Errores
        Rp.MensajeError = Rpexec.MensajeError
    End Sub


End Class
 